package cn.dc406.labc406mgr.mapper;

import cn.dc406.labc406mgr.entity.ApplyTable;
import cn.dc406.labc406mgr.entity.LendTable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface LendMapper {
    @Select("select l.id,i.`name`,i.guige,i.xinghao,i.amount,l.num,l.applytime,l.lendtime,l.returntime,l.state  from items i join" +
            " lenddetails l where i.id=l.itemid and l.username=#{username} and l.state!='0' ORDER BY l.id desc;")
    List<LendTable> selectLendDetailsAllByUsername(String username);

    @Update("update lenddetails set state=#{state},returntime=#{returntime} where id=#{id}")
    int updateLendStateByID(LendTable lendTable);
}
